<!DOCTYPE HTML>
<html lang="en">
<head>
<title>ExitApp - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The ExitApp command terminates the script unconditionally." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>ExitApp</h1>

<p>Terminates the script unconditionally.</p>

<pre class="Syntax"><span class="func">ExitApp</span> <span class="optional">, ExitCode</span></pre>
<h2>Parameters</h2>
<dl>

  <dt>ExitCode</dt>
  <dd><p>An integer between -2147483648 and 2147483647 (or <span class="ver">[in v1.0.48.01+]</span> an <a href="../Variables.htm#Expressions">expression</a>) that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file. If omitted, <em>ExitCode</em> defaults to zero. Zero is traditionally used to indicate success.</p></dd>

</dl>

<h2>Remarks</h2>
<p>The script is immediately terminated unless it has an <a href="OnExit.htm">OnExit</a> subroutine. This is equivalent to choosing &quot;Exit&quot; from the script's tray menu or main menu.</p>
<p><a href="Exit.htm">Exit</a> and ExitApp behave identically when the script contains no hotkeys, is not <a href="_Persistent.htm">persistent</a>, and does not ask for <kbd>NumLock</kbd>/<kbd>ScrollLock</kbd>/<kbd>CapsLock</kbd> to be kept AlwaysOn or AlwaysOff.</p>
<p>If the script has an <a href="OnExit.htm">OnExit</a> subroutine, it will be run in response to ExitApp.</p>
<h2>Related</h2>
<p><a href="Exit.htm">Exit</a>, <a href="OnExit.htm">OnExit</a>, <a href="_Persistent.htm">#Persistent</a></p>
<h2>Examples</h2>
<div class="ex" id="ExHotkey">
<p><a href="#ExHotkey">#1</a></p>
<pre>#x::ExitApp  <em>; Assign a hotkey to terminate this script.</em></pre>
</div>

</body>
</html>
